package vip.xiaonuo.smzq.modular.kcl.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.kcl.entity.Ckqsqdjs;
import vip.xiaonuo.smzq.modular.kcl.entity.vo.CkqApplicationLists;
import vip.xiaonuo.smzq.modular.kcl.service.ICkqsqdjsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 采矿权申请登记书
 *
 * @author sqq
 * @since 2024-04-21
 */
@Api(tags = "采矿权申请登记书")
@RestController
@RequestMapping("/kcl/ckqsqdjs")
@Validated
public class CkqsqdjsController {

    @Resource
    private ICkqsqdjsService iCkqsqdjsService;

    /**
     * 添加采矿权申请登记书
     */
    @ApiOperation("添加采矿权申请登记书")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid CkqApplicationLists ckqApplicationList) {
        iCkqsqdjsService.addiCkqsqdjsService(ckqApplicationList);
        //iCkqsqdjsService.save(ckqsqdjs);
        return CommonResult.ok();
    }

    /**
     * 删除采矿权申请登记书
     */
    @ApiOperation("删除采矿权申请登记书")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iCkqsqdjsService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑采矿权申请登记书
     */
    @ApiOperation("编辑采矿权申请登记书")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid Ckqsqdjs ckqsqdjs) {
        iCkqsqdjsService.updateById(ckqsqdjs);
        return CommonResult.ok();
    }

    /**
     * 采矿权申请登记书分页查询
     */
    @ApiOperation("采矿权申请登记书分页查询")
    @GetMapping("/list")
    public CommonResult<Page<Ckqsqdjs>> page() {
        return CommonResult.data(iCkqsqdjsService.page(new Ckqsqdjs()));
    }
    /**
     * 采矿权申请登记书分页查询
     */
    @ApiOperation("采矿权申请登记书详情查询")
    @GetMapping("/getCkqApplicationLists")
    public CommonResult<CkqApplicationLists> getCkqApplicationLists(
        String ckqsqsid
    ) {
        return CommonResult.data(iCkqsqdjsService.getCkqApplicationLists(ckqsqsid));
    }
}
